/*
* 代码来源：https://www.cnblogs.com/lzy321/p/10789808.html
*/
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class menu_li001 {
    public static void main(String[] args) {
        menu_li002 li = new menu_li002();
        li.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        li.setVisible(true);
        li.pack();
        li.setSize(600,100);

    }
}

class menu_li002 extends JFrame{
    static int i;
    public menu_li002(){
        TextField f1 = new TextField(24);
        new Box(BoxLayout.X_AXIS);
        JPanel card=new JPanel();
        CardLayout Clayout=new CardLayout();
        JPanel mi = new JPanel();
        JRadioButton choose02 = new JRadioButton("计算器");
        JLabel  calculter =new   JLabel(new ImageIcon("src/calculter.jpg"));
        Box h = Box.createHorizontalBox();
        Box h1 = Box.createHorizontalBox();
        Box vbox = Box.createVerticalBox();
        ButtonGroup bg1 = new ButtonGroup();
        ButtonGroup bg2 = new ButtonGroup();
        ButtonGroup bg3 = new ButtonGroup();
        bg2.add(choose02);
        h.add(choose02);
        h1.add(f1);
        vbox.add(h);
        vbox.add(h1);
        setContentPane(vbox);
        mi.add(h);
        mi.add(h1);
        card.add(mi);
        add(card);
        choose02.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                f1.setText("你选中:" + choose02.getText());
                add(BorderLayout.SOUTH,calculter);
                //contentPane.add(calculter);
                CacultorL window=new CacultorL();
                window.setSize(500,300);
              window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                window.pack();
                window.setJMenuBar(CacultorL.menuBar);
                window.setVisible(true);
                bg1.clearSelection();
                bg3.clearSelection();
            }
        });
    }
}
